/*******************************************************************************
Project : Header-Datei fuer das Modul "CAN_MCP2510"
Version : 1.0
Date    : 24.06.2007
Author  : Guenther Pammer

Compilerswitches: keine
*******************************************************************************/
#ifndef CAN_MCP2510_H
#define CAN_MCP2510_H 1

#include "CAN_MCP2510_C.h"
#include "SPI_MCP2510.h"               // SPI-Schnittstelle zur Anbindung

#define CANTYPE 2510

// Defines zu Baudraten
#define CAN_BAUD_10k   0
#define CAN_BAUD_20k   1
#define CAN_BAUD_50k   2
#define CAN_BAUD_125k  3
#define CAN_BAUD_250k  4
#define CAN_BAUD_500k  5
#define CAN_BAUD_1M    6

// Prototypen
         void CAN_MCP2510_set_output ( unsigned char addr, unsigned char value );

unsigned char CAN_MCP2510_get_input ( unsigned char addr );

         void CAN_MCP2510_init ( unsigned long int baudrate, unsigned char txint,
                                 unsigned char rxint, unsigned char errorint );
 
         void CAN_MCP2510_config_rx_mask_filter ( unsigned char rx_buf_nr,
                                                  unsigned char ctrl,
                                                  unsigned int  mask,
                                                  unsigned int  filter );

         void CAN_MCP2510_msg_wr    ( unsigned int msg_id,
                                      unsigned char tx_buf_nr,  // 0-2 erlaubt
                                      unsigned char *src,
                                      unsigned char len);

         void CAN_MCP2510_msg_rd    ( unsigned char rx_buf_nr,  // 0, 1 erlaubt
                                      unsigned char *dest,
                                      unsigned char *dlc);

         void CAN_MCP2510_interrupt_service ( unsigned char* can_state_reg,
                                              unsigned char* int_flag_reg,
                                              unsigned char* error_flag_reg,
                                              unsigned char* msg,
                                              unsigned char* msg_len);
#endif // CAN_MCP2510_H
